package com.android.hedgehog;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class Profile extends Activity {
	EditText age;
	Button save;
	TextView greet;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.profile2);
		age = (EditText) findViewById(R.id.etAge);
		// age.setText(Settings.age);
		save = (Button) findViewById(R.id.bSave);
		greet = (TextView) findViewById(R.id.tvGreet);
		greet.setText("is your age: "+Settings.age);
		save.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				try {

					if (Integer.parseInt(age.getText().toString()) > 0) {
						finish();
						Settings.age = Integer.parseInt(age.getText().toString());
					}
				} catch (NumberFormatException ex) {
				}
			}
		});

		// finish(); must be added to call onDestroy
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
	}

}
